import request  from "./AxiosRequest.js";
var vm = new Vue({
    el : '#dpLTE',
    data : {
        username : '13370752411',
        password : '123456'
    },
    methods : {
        login : function() {
            let data={
                client_id:"im",
                client_secret:"im",
                mobile:this.username,
                password:this.password,
                grant_type:"password",
                scope:"all",
            };
            console.log(data);
            localStorage.removeItem("access_token");
            request.post('/api/oauth/token',data,{}).then(res=>{
                if (res.code==0){
                    localStorage.setItem("access_token",res.data.access_token);
                    localStorage.setItem("refresh_token",res.data.refresh_token);
                    $(location).attr('href', '/jsencrypt.html')
                }else {
                    top.layer.msg('登录失败！错误码：'+res.code);
                }
            }).catch(res => {
                console.log(JSON.stringify(res));
                top.layer.msg('登录失败！');
            });
        }
    }
});

layui.use(['form','axios'], function () {
    var form = layui.form,
        layer = layui.layer;
    let axios = layui.axios;
    // 粒子线条背景
    $(document).ready(function () {
        $('.layui-container').particleground({
            dotColor: '#7ec7fd',
            lineColor: '#7ec7fd'
        });
    });
});